﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dashboard.aspx.cs" Inherits="PMP.Checklist.Dashboard" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Checklist Dashboard</title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td colspan="2">
                    Task: <asp:TextBox ID="txtTaskID" runat="server"></asp:TextBox>
                    <asp:Button ID="btnCheck" runat="server" onclick="btnCheck_Click" 
                        Text="Check" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="grvAvailable" runat="server" AutoGenerateColumns="False"  OnRowCommand="grvAvailable_RowCommand" 
                        CellPadding="4" DataSourceID="SqlDataSourceAvailable" ForeColor="#333333" 
                        GridLines="None">
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:ButtonField CommandName="SelectChecklist" HeaderText="Select" 
                                Text="Select" />
                            <asp:BoundField DataField="component" HeaderText="component" 
                                SortExpression="component" />
                        </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSourceAvailable" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="select distinct component from checklist order by component">
                    </asp:SqlDataSource>
                </td>
                <td>
                    <asp:GridView ID="grvAssigned" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" ForeColor="#333333"   OnRowCommand="grvAssigned_RowCommand" 
                        GridLines="None">
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:BoundField DataField="component" HeaderText="component" 
                                SortExpression="component" />
                            <asp:ButtonField CommandName="DropChecklist" HeaderText="Drop" Text="Drop" />
                        </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSourceAssigned" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="SELECT [component] FROM [checklist_task]">
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
    
    </div>
    <table class="style1">
        <tr>
            <td style="text-align: center">
                Report</td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="grvReport" runat="server" CellPadding="4" ForeColor="#333333" 
                    GridLines="Both" AutoGenerateColumns="False"
                    DataSourceID="SqlDataSourceReport">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:BoundField DataField="item_desc" HeaderText="item_desc" 
                            SortExpression="item_desc" />
                        <asp:BoundField DataField="results" HeaderText="results" 
                            SortExpression="results" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSourceReport" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" SelectCommand="select item_desc, results
  from checklist_task
  join checklist on (checklist_task.checklist_id = checklist.ID)
 where rev = (select max(rev) from checklist_task)"></asp:SqlDataSource>
            </td>
        </tr>
    </table>
    </form>
    </body>
</html>
